import unittest
from time import sleep
from selenium import webdriver
from login_ylh import login
class OALogin(unittest.TestCase):
    def setUp(self) -> None:
        self.driver=login()
        # self.driver = webdriver.Firefox()
        # self.driver.get(r'http://127.0.0.1:8080/oa')
        # self.driver.implicitly_wait(10)
        # self.driver.find_element('name','loginId').send_keys('admin')
        # self.driver.find_element('name','password').send_keys('sys123456')
        # self.driver.find_element('id','button_submit').click()
        sleep(2)
    def test_gzjl_01(self):#第一个正向
        self.driver.find_element('xpath', '/html/body/div[2]/div/h3[5]/a').click()  # 点击工作记录
        sleep(2)
        self.driver.find_element('xpath', '//*[@id="leftmenuDiv"]/div[5]/table/tbody/tr[2]/td/a/img').click()#点击我的日志
        sleep(2)
        ele1=self.driver.find_element('xpath','//*[@id="iframe_main"]')
        self.driver.switch_to.frame(ele1)
        self.driver.find_element('xpath', '/html/body/form[1]/div[1]/div[1]/button').click()
        sleep(2)
        self.driver.switch_to.default_content()
        ele2=self.driver.find_element('xpath','/html/body/div[1]/div/table/tbody/tr[2]/td[2]/div/table/tbody/tr[2]/td/div/iframe')
        self.driver.switch_to.frame(ele2)
        self.driver.find_element('id','summary').send_keys('温酒做ge')#写摘要
        sleep(2)
        self.driver.switch_to.frame(self.driver.find_element('id', 'baidu_editor_0'))  # 进入输入内容页面
        self.driver.find_element('xpath', '/html').send_keys('borring')
        self.driver.switch_to.parent_frame()
        self.driver.find_element('id','button_send').click()#点击提交
        sleep(2)
        self.driver.switch_to.default_content()
        self.driver.find_element('class name','d-button').click()#点击弹出框确认
        sleep(2)

    def tearDown(self) -> None:
        self.driver.close()
if __name__ == '__main__':
    unittest.main()